﻿#pragma once
#include<vector>
#include<string>
#include<thread>

// CDialogChatWin 对话框

struct UserInfo {
public:
	std::string nickname_;
	std::string school_;
	int user_id_;
	//历史和这个好友发送过的消息
	std::vector<std::string> history_msg_;
	//未读的消息个数
	int msg_cnt_;
};


class CDialogChatWin : public CDialogEx
{
	DECLARE_DYNAMIC(CDialogChatWin)

public:
	CDialogChatWin(int user_id, CWnd* pParent = nullptr);   // 标准构造函数
	virtual ~CDialogChatWin();

	int user_id_;

// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_Chat };
#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedButtonaddfriend();
	afx_msg void OnLbnSelchangeListuser();
	afx_msg void OnLbnSelchangeListoutput();
	afx_msg void OnEnChangeEditinput();
	afx_msg void OnBnClickedButtonesendmsg();
	void RefreshUserList();
	virtual BOOL OnInitDialog();

	int send_user_id_;
	std::vector<struct UserInfo> fri_vec_;
	CListBox m_userlist_;
	CListBox m_output_;
	CString m_input_;
	CEdit m_input_edit_;
	virtual BOOL PreTranslateMessage(MSG* pMsg);
};
